// menu.h 

#define PICWIDTH 352
#define MENU_OPEN 	0x0000
#define MENU_SHUT   0x0001
#define MENUMEMORYSIZE 200000

#ifndef SOUND_INC
#define SOUND_INC 18
#endif

#define MENUB struct st_mbutton
MENUB
{
 long	bname; //Button name
 long	up;    //Button up
 long	down;  //Button down
 long	left;  //Button left
 long	right; //Button right
 long	bx;    //Button loc x
 long	by;    //Button loc y
 long	tx;    //Text pos x
 long	ty;    //Text pos y
 char   hasimage; //The button has an image
 short  bwidth;  //The button image width
 short  bheight; //The button image height
 char  *bimage; //The button image
};

#define MENUI struct st_menuimage
MENUI   
{
short  width;
short  height;
char  *ImageData;
char  *Scratch;
};

#define MENU  struct st_menu
MENU
{
long    mname;
long    x;
long    y;
long	numbuttons;		//Number of buttons
long	initialbutton;  //Initial button
MENUB   *buttons;       //Menu Buttons;
MENUI   MainImage;     //Menu Image
MENUI   PickImage;        //Menu picker
};

#define GAMEMENUTYPE	0
#define SCRMMENUTYPE	1

//Predfined menus
#define MAINMENU		0
#define MMB_NEWGAME	0
#define MMB_SAVEGAME	1	
#define MMB_LOADGAME	2
#define MMB_OPTIONS	3
#define MMB_QUIT		4

#define SAVEMENU		1 
#define SMB_ENTRY1	0
#define SMB_ENTRY2	1	
#define SMB_ENTRY3	2
#define SMB_ENTRY4	3
#define SMB_ENTRY5	4

#define LOADMENU		2
#define LMB_ENTRY1	0
#define LMB_ENTRY2	1	
#define LMB_ENTRY3	2
#define LMB_ENTRY4	3
#define LMB_ENTRY5	4

#define OPTSMENU 		3
#define OMB_ENTRY1	0
#define OMB_ENTRY2  	1	
#define OMB_ENTRY3	2
#define OMB_ENTRY4	3
#define OMB_ENTRY5	4

#define CTLSMENU		4
#define OMB_ENTRY1	0
#define OMB_ENTRY2	1	
#define OMB_ENTRY3	2
#define OMB_ENTRY4	3
#define OMB_ENTRY5	4

#define AUDIMENU		5
#define OMB_ENTRY1	0
#define OMB_ENTRY2	1	
#define OMB_ENTRY3	2
#define OMB_ENTRY4	3
#define OMB_ENTRY5	4
#define OMB_ENTRY6	5
#define OMB_ENTRY7	6
#define OMB_ENTRY8	7

//Secret Room Menu
#define SCRMMENU		10
#define SRMB_ENTRY1	0
#define SRMB_ENTRY2	1 
#define SRMB_ENTRY3	2 
#define SRMB_ENTRY4	3 
#define SRMB_AIRES 	4
#define SRMB_CIRCLE	5
#define SRMB_SQUARE	6
#define SRMB_OBLONG	7
#define SRMB_TRIANGLE 8


//----------------------------------------------------------

#ifdef _FWMENU_
#define OpenMenu(mn,sb)       AccessMenu(mn,sb,MENU_OPEN)
#define CloseMenu(mn,sb)      AccessMenu(mn,sb,MENU_SHUT)
#define OpenButton(mn,pb,sb)  AccessButton(mn,pb,sb,MENU_OPEN)
#define CloseButton(mn,pb,sb) AccessButton(mn,pb,sb,MENU_SHUT)

long  g_nummenus;
MENU *g_menus = (MENU *) NULL;
MENU *g_secrrmmenu = (MENU *) NULL;
void *g_menumemory = (void *) NULL; //Allocation for menus
char codes[4] = {0x08,0x04,0x02,0x01};

void *GetMenuMemory(long amtreq);
void *FreeMenuMemory();
void  AccessMenu(long menunum, char *screenbuf,long openclose);
void  AccessButton(long menunum,long buttonnum,char *screenbuf,long openclose);

void ProcessMenu(long menunum, char *screenbuffer);
void LoadMenus(long menutype);
#else
extern MENU *g_menus;
extern MENU *g_secrrmmenu;
extern void  LoadMenus(long menutype);
extern void  ProcessMenu(long menunum, char *screenbuffer);
extern void *FreeMenuMemory();
extern void *GetMenuMemory(long amtreq);
#endif
